package org.jeecg.modules.controller;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.entity.SysUserTit;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.modules.course.entity.AstuCourse;
import org.jeecg.modules.course.service.IAstuCourseService;
import org.jeecg.modules.tea_stu_course.entity.AstuTeastuCourse;
import org.jeecg.modules.teacher_course.entity.AstuTeacherCourse;
import org.jeecg.modules.teacher_course.mapper.AstuTeacherCourseMapper;
import org.jeecg.modules.teacher_course.service.IAstuTeacherCourseService;
import org.jeecg.modules.vo.CourseInformation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Objects;

/**
 * @author 刘燿奇
 * @version 1.0
 * @date 2021/10/11 16:16
 */
@Slf4j
@Api(tags="查看课程的列表")
@RestController
@RequestMapping("/CourseListController")
public class CourseListController {
    @Autowired
    private IAstuTeacherCourseService iAstuTeacherCourseService;
    @Autowired
    private IAstuCourseService iAstuCourseService;

    @ApiOperation("查询老师课程表信息")
    @RequestMapping(value = "/getTeacherCourseInformation", method = RequestMethod.POST)
    public Result<JSONObject> getInformation() {
        Result<JSONObject> result = new Result<>();
        List<AstuTeacherCourse> astuTeacherCourses = iAstuTeacherCourseService.selectAll();
        JSONObject obj = new JSONObject();
        obj.put("astuTeacherCourses", astuTeacherCourses);
        result.setResult(obj);
        result.success("成功");
        return result;
    }


    @ApiOperation("查询实验id和实验名称")
    @RequestMapping(value = "/getEIdAndEName", method = RequestMethod.POST)
    public Result<JSONObject> getEIdAndEName() {
        Result<JSONObject> result = new Result<>();
        List<Object> objects1 = iAstuTeacherCourseService.selectEIdAndEName();
        JSONObject obj = new JSONObject();
        obj.put("objects1", objects1);
        result.setResult(obj);
        result.success("成功");
        return result;
    }

    @ApiOperation("老师看学生的成绩列表")
    @RequestMapping(value = "/getSelectCourseList", method = RequestMethod.POST)
    public Result<JSONObject> getSelectCourseList() {
        Result<JSONObject> result = new Result<JSONObject>();
        List<AstuCourse> astuCourses = iAstuCourseService.selectAll();
        JSONObject obj = new JSONObject();
        List<AstuTeastuCourse> numberAndNames = iAstuCourseService.selectStuNumberAndStuName();
        obj.put("numberAndName",numberAndNames);
        obj.put("astuCourses", astuCourses);
        result.setResult(obj);
        result.success("成功");
        return result;
    }


}
